<%-------------------------------------------------------------------
 * 页面名称：operCompetence.jsp
 * 功能描述：查看操作员权限
 * Action: 
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
	String path = request.getContextPath();
%>
<script language="javascript">
	function submitProcess() {
		document.forms[0].submit();
	}
			function checkThisRow(obj,clientId) {
				var inputs = document.getElementsByTagName("input");
				for(i=0;i<inputs.length;i++) {
					var input = inputs[i];
					if(input.type == "checkbox") {
						if(typeof(input.getAttribute("clientId")) != "undefined") {
							if(input.getAttribute("clientId") == clientId) {
								input.checked = obj.checked;
							}
						}
					} 
				} 
			}
			
			function checkThisRowFirst(obj,clientId) {
				var inputs = document.getElementsByTagName("input");
				var check = false;
				for(i=0;i<inputs.length;i++) {
					var input = inputs[i];
					if(input.type == "checkbox") {
						if(input.getAttribute("value") == clientId) {
							if(obj.checked) {
								input.checked = true;
							} else {
								input.checked = containCheck(clientId);
							}
						}
					}
				}
			}
			
			function containCheck(clientId) {
				var inputs = document.getElementsByTagName("input");
				var check = false;
				for(i=0;i<inputs.length;i++) {
					var input = inputs[i];
					if(input.type == "checkbox") {
						if(typeof(input.getAttribute("clientId")) != "undefined") {
							if(input.getAttribute("clientId") == clientId) {
								if(input.checked) {
									check = true;
									break;
								}
							}
						}
					}
				}
				return check;				
			}
		
</script>
<div id="main">
	<form action="modifyOperatorConpetent.do" method="post">
		<input type="hidden" name="oprId"
			value="<bean:write name="oper" property="id" />" />
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="titleinfo">
					查看操作员权限
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" align="center" cellpadding="5"
						cellspacing="1">
						<tr>
							<td width="22%" align="right">
								姓名：
							</td>
							<td width="78%" class="font_blue">
								<bean:write name="oper" property="operatorName" />
							</td>
						</tr>
						<logic:iterate id="subAccount" name="subAccontList">
							<tr>
								<td align="right">
									子账户：
								</td>
								<td class="font_blue">
									 <input name="operatorSubaccountAll" type="checkbox"
										style="border:0"
										value="<bean:write name='subAccount' property='id'/>"
										onClick="checkThisRow(this,'<bean:write name='subAccount' property='id'/>')"
										<logic:present name="actionTypeHere">disabled</logic:present>></input>
									<bean:write name="subAccount" property="accountName" />
									<logic:iterate id="type" name="typeList">
										<input
											clientId="<bean:write name='subAccount' property='id'/>"
											type="checkbox" style="border:0" name="operatorSubaccount"
											value="<bean:write name='subAccount' property='id'/>:<bean:write name='type' property='value'/>"
											onClick="checkThisRowFirst(this,'<bean:write name='subAccount' property='id'/>')"
											<logic:present name="actionTypeHere">disabled</logic:present>></input>
										<bean:write name="type" property="label" />
									</logic:iterate>
								</td>
							</tr>
						</logic:iterate>
						<tr>
							<td height="55" align="right">
								&nbsp;
							</td>
							<td class="font_blue">
								<logic:notPresent name="actionTypeHere">
									<input name="button3" type="button" class="button_style"
										onclick="submitProcess();" value="确 定" />
								</logic:notPresent>
								<input name="button3" type="button" class="button_style"
									onclick="history.back();" value="返 回" />
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</form>
</div>
<script language="javascript">
	var selectStrings = "<bean:write name="selectStrings"/>";
	var selectArray = selectStrings.split(",");
	
	var inputs = document.getElementsByTagName("input");
	for(i=0;i<selectArray.length;i++) {
		var selectArray2 = selectArray[i].split(":");
		var subAccountId = selectArray2[0];
		for(j=0;j<inputs.length;j++) {
			if(inputs[j].type == "checkbox") {
				if(inputs[j].getAttribute("value") == selectArray[i] || inputs[j].getAttribute("value") == subAccountId) {
					inputs[j].checked = true;
				}
			}
		}
	}
</script>
